//
//  GoodTableViewCell.m
//  庐山通
//
//  Created by zcj on 15-10-26.
//  Copyright (c) 2015年 郑朝军. All rights reserved.
//

#import "GoodTableViewCell.h"
#import "UIImageView+WebCache.h"
#import "GoodDataFrame.h"
#import "GoodData.h"
#import "GoodImage.h"
#import "GoodsMainImageModel.h"
#import "Grouble.h"
#import "GoodInforModel.h"

@interface GoodTableViewCell()
@property (nonatomic,weak)UIImageView *TopImg;
@property (nonatomic,weak)UIImageView *RightImg;

@property (nonatomic,weak)UIImageView *TeweenImg;

@property (nonatomic,weak)UIImageView *LeftImg;

@property (nonatomic,weak)UILabel * shopName;
@property (nonatomic,weak)UILabel * ShopSource;

@end
@implementation GoodTableViewCell

- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        UIImageView *TopImg = [[UIImageView alloc]init];
        [self addSubview:TopImg];
        self.TopImg = TopImg;
        
        UIImageView *RightImg = [[UIImageView alloc]init];
     
        [self addSubview:RightImg];
        self.RightImg = RightImg;
        
        UIImageView *TeweenImg = [[UIImageView alloc]init];
        
        [self addSubview:TeweenImg];
        self.TeweenImg = TeweenImg;
        
        UILabel * shopName = [[UILabel alloc]init];
        shopName.numberOfLines = 0;
        [self addSubview:shopName];
        self.shopName = shopName;
        
        UILabel * ShopSource = [[UILabel alloc]init];
        ShopSource.numberOfLines = 0;
        [self addSubview:ShopSource];
        self.ShopSource = ShopSource;
        
        // Initialization code
    }
    return self;
}
+(instancetype)GoodTableViewCell:(UITableView *)tableView
{
    static NSString * ID = @"goodcell";
    GoodTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:ID];
    if (cell == nil) {
        cell = [[GoodTableViewCell alloc]initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:ID];
    }
    return cell;
}
- (void)setGoodDataFrame:(GoodDataFrame *)goodDataFrame
{
    _goodDataFrame = goodDataFrame;
   
    NSString * imgUrl =goodDataFrame.goodData.main_image.image_original;
    
    [self.TopImg setImageWithURL:[NSURL URLWithString:imgUrl] placeholderImage:[UIImage imageNamed:@"close"]];
    self.TopImg.frame = goodDataFrame.topImgF;
    
    NSString * rigthUrl = goodDataFrame.goodData.main_image.image_middle;
    NSString * teweenUrl = goodDataFrame.goodData.main_image.image_thumbnail;
    ZCJLog(@"--------%@--------",rigthUrl);
    
    ZCJLog(@"--------1%@--------",teweenUrl);
    [self.RightImg setImageWithURL:[NSURL URLWithString:rigthUrl] placeholderImage:[UIImage imageNamed:@"close_right"]];
    
    self.RightImg.frame = goodDataFrame.rightImgF;
    
    [self.TeweenImg setImageWithURL:[NSURL URLWithString:teweenUrl] placeholderImage:[UIImage imageNamed:@"close_left"]];
    self.TeweenImg.frame = goodDataFrame.retweenImgF;
    
    
    self.shopName.text = goodDataFrame.goodData.goods_name;
    self.shopName.frame = goodDataFrame.shopNameF;
    
    self.ShopSource.text = goodDataFrame.goodData.group_info.country;
    self.ShopSource.frame = goodDataFrame.shopSourceF;
}
- (void)awakeFromNib
{
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated
{
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
